
get_filename_component(CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_executable(${PROJECT_NAME}_${CURRENT_DIR_NAME}_crc crc.c)
target_link_libraries(${PROJECT_NAME}_${CURRENT_DIR_NAME}_crc ${PROJECT_NAME})

add_test(NAME ${CURRENT_DIR_NAME}_crc16 COMMAND ${PROJECT_NAME}_${CURRENT_DIR_NAME}_crc "crc16" "abcd1234" "40311")
add_test(NAME ${CURRENT_DIR_NAME}_crc32 COMMAND ${PROJECT_NAME}_${CURRENT_DIR_NAME}_crc "crc32" "abcd1234" "1027584326")


create_test_sourcelist(tests_source_list  tests_source_list.c
    test_base64.c
    test_md5.c
    test_file.c
    test_net.c
    test_ringbuf.c
    test_timer.c
    test_log.c
)
add_executable (${PROJECT_NAME}_${CURRENT_DIR_NAME}_AIO ${tests_source_list}) # all in one
target_link_libraries(${PROJECT_NAME}_${CURRENT_DIR_NAME}_AIO ${PROJECT_NAME})
list(REMOVE_ITEM tests_source_list tests_source_list.c)
foreach (test ${tests_source_list})
  get_filename_component (TName ${test} NAME_WE)
  add_test (NAME ${TName} COMMAND ${PROJECT_NAME}_${CURRENT_DIR_NAME}_AIO ${TName})
endforeach ()
